package com.qunduikj.sjb.sdk.model.api;

import com.litesuits.android.log.Log;
import com.litesuits.http.data.NameValuePair;
import com.litesuits.http.request.content.HttpBody;
import com.litesuits.http.request.content.UrlEncodedFormBody;
import com.litesuits.http.request.param.HttpRichParamModel;
import com.litesuits.http.request.query.JsonQueryBuilder;
import com.litesuits.sdk.model.Model;
import com.qunduikj.sjb.sdk.AppSdk;

import java.util.List;

/**
 * Base class for all api parameters.
 *
 * @author MaTianyu on 2015-05-05
 */
public abstract class ApiUnEncriptParam<T extends ApiModel> extends HttpRichParamModel<T> implements Model {
    protected static final JsonQueryBuilder objToMap = new JsonQueryBuilder();
    protected static final AppSdk sdk = AppSdk.getInstance();
    private static final String TAG = ApiUnEncriptParam.class.getSimpleName();

    @Override
    public boolean isFieldsAttachToUrl() {
        return false;
    }

    @Override
    public HttpBody createHttpBody() {
        try {
            List<NameValuePair> list = objToMap.buildPrimaryPair(this);
            Log.i(TAG, "无加密" + list);
            return new UrlEncodedFormBody(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }



}
